module(
    name = "com_github_mvukov_rules_ros2",
    version = "0.0.0-20250612-f0d04fe",
)

bazel_dep(name = "asio", version = "1.32.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "boringssl", version = "0.20250415.0")
bazel_dep(name = "curl", version = "8.8.0.bcr.3")
bazel_dep(name = "eigen", version = "3.4.0.bcr.3")
bazel_dep(name = "fmt", version = "10.2.1.bcr.1")
bazel_dep(name = "libyaml", version = "0.2.5")
bazel_dep(name = "lz4", version = "1.9.4")
bazel_dep(name = "nlohmann_json", version = "3.11.3.bcr.1")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "pybind11_bazel", version = "2.13.6")
bazel_dep(name = "readerwriterqueue", version = "1.0.6")
bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "rules_foreign_cc", version = "0.13.0")
bazel_dep(name = "rules_python", version = "1.1.0")
bazel_dep(name = "rules_rust", version = "0.59.2")
bazel_dep(name = "rules_rust_bindgen", version = "0.59.2")
bazel_dep(name = "rules_shell", version = "0.4.0")
bazel_dep(name = "spdlog", version = "1.15.2")
bazel_dep(name = "sqlite3", version = "3.42.0.bcr.1")
bazel_dep(name = "tinyxml", version = "2.6.2")
bazel_dep(name = "tinyxml2", version = "10.0.0")
bazel_dep(name = "websocketpp", version = "0.8.2.bcr.3")
bazel_dep(name = "yaml-cpp", version = "0.8.0")
bazel_dep(name = "zlib", version = "1.3.1.bcr.5")
bazel_dep(name = "zstd", version = "1.5.7")

bazel_dep(name = "googletest", version = "1.17.0", dev_dependency = True)

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "ros2_rust",
    build_file = "//repositories:ros2_rust.BUILD.bazel",
    patch_args = ["-p1"],
    patches = [
        "//repositories/patches:ros2_rust_fix_rclrs.patch",
        "//repositories/patches:ros2_rust_fix_rosidl_generator.patch",
        "//repositories/patches:ros2_rust_fix_rosidl_runtime.patch",
    ],
    sha256 = "6ef8722c2dde10e5c2fc1b9aef6ec3cc397f8cda40d58743045584aa59a6b0c8",
    strip_prefix = "ros2_rust-9a845c17873cbdf49e8017d5f0af6d8f795589cc",
    urls = ["https://github.com/ros2-rust/ros2_rust/archive/9a845c17873cbdf49e8017d5f0af6d8f795589cc.zip"],
)

_PYTHON_VERSIONS = [
    "3.10",
    "3.11",
    "3.12",
    "3.13",
]

_DEFAULT_PYTHON = "3.10"

python = use_extension("@rules_python//python/extensions:python.bzl", "python")

[
    python.toolchain(
        is_default = python_version == _DEFAULT_PYTHON,
        python_version = python_version,
    )
    for python_version in _PYTHON_VERSIONS
]

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")

[
    pip.parse(
        hub_name = "rules_ros2_pip_deps",
        python_version = python_version,
        requirements_lock = "//:requirements_lock.txt",
    )
    for python_version in _PYTHON_VERSIONS
]

use_repo(pip, "rules_ros2_pip_deps")

dev_pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True)
dev_pip.parse(
    hub_name = "rules_ros2_resolver_deps",
    python_version = "3.10",
    requirements_lock = "//repositories/private:resolver_requirements_lock.txt",
)
use_repo(dev_pip, "rules_ros2_resolver_deps")

pybind_configure = use_extension("@pybind11_bazel//:internal_configure.bzl", "internal_configure_extension")
use_repo(pybind_configure, "pybind11")

register_toolchains(
    "@com_github_mvukov_rules_ros2//repositories/rust:bindgen_toolchain",
    dev_dependency = True,
)

# Keep specs in sync with repositories/rust_setup_stage_3.bzl
crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate")
crate.spec(
    package = "futures",
    version = "0.3",
)
crate.spec(
    features = ["derive"],
    package = "serde",
    version = "1",
)
crate.spec(
    package = "serde-big-array",
    version = "0.5",
)
crate.spec(
    package = "serde_json",
    version = "1",
)
crate.spec(
    package = "signal-hook",
    version = "0.3",
)
crate.from_cargo(
    name = "rules_ros2_crate_index",
    cargo_lockfile = "//repositories/rust:Cargo.lock",
)
use_repo(crate, "rules_ros2_crate_index")

rules_ros2_non_module_deps = use_extension("//ros2:extensions.bzl", "non_module_deps")
use_repo(
    rules_ros2_non_module_deps,
    "cyclonedds",
    "foxglove_bridge",
    "iceoryx",
    "osrf_pycommon",
    "ros2",
    "ros2_ament_index",
    "ros2_class_loader",
    "ros2_common_interfaces",
    "ros2_diagnostics",
    "ros2_geometry2",
    "ros2_image_common",
    "ros2_kdl_parser",
    "ros2_keyboard_handler",
    "ros2_launch",
    "ros2_launch_ros",
    "ros2_libstatistics_collector",
    "ros2_message_filters",
    "ros2_pluginlib",
    "ros2_rcl",
    "ros2_rcl_interfaces",
    "ros2_rcl_logging",
    "ros2_rclcpp",
    "ros2_rclpy",
    "ros2_rcpputils",
    "ros2_rcutils",
    "ros2_resource_retriever",
    "ros2_rmw",
    "ros2_rmw_cyclonedds",
    "ros2_rmw_dds_common",
    "ros2_rmw_implementation",
    "ros2_robot_state_publisher",
    "ros2_rosbag2",
    "ros2_rosidl",
    "ros2_rosidl_python",
    "ros2_rosidl_runtime_py",
    "ros2_rosidl_typesupport",
    "ros2_rpyutils",
    "ros2_tracing",
    "ros2_unique_identifier_msgs",
    "ros2_urdfdom",
    "ros2_urdfdom_headers",
    "ros2_xacro",
    "ros2cli",
    "rules_ros2_config_clang",
)